<template>
    <section>
  			 <el-table
  			 	border
			      :data="tableData"
			      style="width: 100%">
				    <el-table-column label="序号" align="center" width = "80">
						 <template slot-scope='scope' >
					          {{Number(scope.$index +1)}}
					        </template>
					</el-table-column>
					
					<el-table-column v-if="activeName!='four'&&activeName!='five'&&groupBy!='status'" label="案件受理量" align="center" width ="80">
						<template slot-scope='scope' >
						 	<span @click="showScope(scope)">{{shouliLiang(scope.row)}}</span>
					    </template>
					</el-table-column>
					
					
					<el-table-column  :label="activeName==='four'||activeName==='five'?'考核范围':'统计范围'" align="center" width = "80">
						 <template slot-scope='scope' >
					         {{area}}
					        </template>
					</el-table-column>
			      
			      <el-table-column 
			      	v-for ="(item,index) in lableData"
			        :prop="index"
			        :label="item"
			        :key='index'
			        align="center"
			        >
			      </el-table-column>
			      
			      <el-table-column v-if="activeName==='four'||activeName==='five'"  label="总分" align="center" width = "80">
						 <template slot-scope='scope'>
					      <el-button
				            type='text'
				          > {{showALL(scope.row)}}</el-button>
					        </template>
					</el-table-column>
			 </el-table>
			 
			 <el-pagination 
			      @current-change="handleCurrentChange"
			      :page-size="Number(pageSize)"
			      layout="prev, pager, next, jumper"
			      :total="Number(pageTotal)">
			  </el-pagination> 
    </section>
</template>

<script>
    export default {
    	props:{
    		lableData:'',
    		tableData:Array,
    		pageSize:'',/*页面大小*/
    		pageTotal:'',/*总数*/
    		activeName:'',
    		areaTime:{
    			type:String,
    			default:'全部时间'
    		},
    		groupBy:{
    			type:String,
    			default:null,
    		}
    	},
        data() {
          return {
          	limit :10
          }
        },
        methods: {
        	 handleCurrentChange(val){/*分页方法*/
        	 	console.log(val)
        	 	this.$emit("gotoPage",val);
        	 },
        	 showScope(val){
        	 	console.log(val);
        	 },
        	 handleCurrentChange(val){
        	 	this.$emit("gotoPage",val);
        	 },
        },
        computed:{
        	showALL(){
        		 return function(value) {/*这TM是什么鬼，字段会不会起名字呀!*/
        		 	let allNum = 0;
        		 	if(this.activeName==='four'){/*协助统计*/
						allNum+=value.caseFeedbackAmount+  /*案件反馈量得分合计*/
		          			value.caseAcceptAmount+    /*案件受理量得分合计*/
		          			value.caseFeedbackAmountRatio+ /*案件按时反馈系数得分合计*/
		          			value.caseAcceptAmountOntime+  /*按时受理案件得分合计*/
		          			value.caseFeedbackAmountOntime+  /*按时反馈案件得分合计*/
		          			value.caseAcceptAmountDelayed+  /*延时受理案件得分合计*/
		          			value.commentSponsorSynergismPoliceAmount+  /*发起协同民警给予评价得分合计 */
		          			value.commentDistributeOrgAmount;  /*分发部门给予评价得分合计 分发人评价*/
					}else if(this.activeName==='five'){/*分发统计*/
						allNum+=value.caseFeedbackAmount+  /*案件反馈量得分合计*/
								value.caseAcceptAmount+    /*案件受理量得分合计*/
								value.caseFeedbackAmountRatio+ /*案件按时反馈系数得分合计*/
								value.caseAcceptAmountOntime+  /*按时受理案件得分合计*/
								value.caseFeedbackAmountOntime+  /*按时反馈案件得分合计*/
								value.caseDistributeAmountOntime+    /*案件分发量合计得分*/
								value.caseDistributeAmountDelayed+ /*延时案件分发量合计得分*/
								value.caseFeedbackAmountDelayed+  /*延时反馈案件得分合计*/
								value.commentSponsorSynergismPoliceAmount+  /*发起协同民警给予评价得分合计 */
								value.commentAcceptBusinessSynergismOrgAmount  /*受理业务协同部门评价得分合计 受理人评价*/
					}
		          	return allNum;
       	 		}
        	},
        	area(){/*时间范围，前端写死*/
        		return this.areaTime;
        	},
        	shouliLiang(){/*案件受理量*/
        		return function(val){
        			return val[2] +val[3];
        		}
        		
        	}
        }
  };
</script>

<style scoped="scoped">
    
</style>